banklist=[
	{"account":"zhangsan","password":"ww22334" ,"balance":130},
	{"account":"lisi","password":"xx22334","balance":1000},
	{"account":"wangwu","password":"ee22334","balance":500},
	{"account":"zhaoliu","password":"cc22334","balance":2000}]

def bal(user_id):
	print("="*7,"账户余额","="*7)
	print("|{0:1}|{1:10}|{2:10}|".format(" ","账户","余额"))
	print("|{0:1}|{1:12}|{2:12}|".format(" ",banklist[user_id]["account"],banklist[user_id]["balance"]))
def moneyin(amount):
	banklist[user_id]["balance"]+=int(amount)

def moneyout(amount):
	i = banklist[user_id]["balance"]-int(amount)
	if i>=0:
		banklist[user_id]["balance"]-=int(amount)
	else:
		print("账户余额不足")

def check(user_account,user_password):

	for i in range(len(banklist)):
		if user_account == banklist[i]["account"] and user_password == banklist[i]["password"]:
				return i
while True:

	print("--------CSDN BANK登录--------")
	user_account = input("请输入账户名：")
	user_password = input("请输入密码:")
	user_id = check(user_account,user_password)
	if user_id != None:
		print("登陆成功")

		while True:
				print("  "*3 ,"ATM存取款系统","  "*3)
				print("{0:1} {1:10} {2:10}".format(" ","1.查询余额","2.现金提取"))
				print("{0:1} {1:10} {2:10}".format(" ","3.现金存入","4.退出系统"))
				y = input("请输入你的选项：")

				if y=="1":
					bal(user_id)
					input("按回车键继续：")
				elif y=="2":
					amount=input("提取金额：")
					moneyout(amount)
					bal(user_id)
					input("按回车键继续：")
				elif y=="3":
					amount=input("存入金额：")
					moneyin(amount)
					bal(user_id)
					input("按回车键继续：")
				elif y=="4":
					print("=="*5,"再见","=="*5)
					break
				else:
					print("你输入的值无效！！！退出请按4")
					input("按回车键继续：")